package com.sun.decrypt;

import org.junit.Test;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class UrlTest {
    private static final String UTF8 = StandardCharsets.UTF_8.name();

    @Test
    public void test1() throws UnsupportedEncodingException {
        String str = "哈哈哈";
        String encode = URLEncoder.encode(str, UTF8);
        System.out.println("加密 " + encode);
        String decode = URLDecoder.decode(encode, UTF8);
        System.out.println("解密 " + decode);
    }
}
